// 用户类型定义
export interface UserInfo {
	id: number;
	username: string;
	nickname?: string;
	avatar?: string;
	points: number;
	role: string;
}

// 规格类型定义
export interface ProductSpec {
	id: number;
	name: string;
	values: string[];
	productId: number;
}

// SKU类型定义
export interface ProductSku {
	id: number;
	specs: Record<string, string>;
	price: number;
	stock: number;
	availableStock: number;
	image?: string;
	productId: number;
}

// 购物车项类型定义
export interface CartItem {
	id: number;
	name: string;
	price: number;
	image: string;
	quantity: number;
	checked: boolean;
	stock: number;
	availableStock?: number;
	skuId?: number;
	skuSpecs?: Record<string, string>;
}

// 地址类型定义
export interface Address {
	id: number;
	userId: number;
	name: string;
	phone: string;
	province: string;
	city: string;
	district: string;
	detail: string;
	isDefault: boolean;
}

// 商品类型定义
export interface Product {
	id: number;
	name: string;
	price: number;
	coverUrl: string;
	description: string;
	category: string;
	status: string;
	stock: number;
	availableStock?: number;
	createdAt: string;
	updatedAt: string;
	specs?: ProductSpec[];
	skus?: ProductSku[];
}

// 订单类型定义
export interface Order {
	id: number;
	userId: number;
	orderNo: string;
	status: string;
	totalAmount: number;
	receiver: string;
	phone: string;
	address: string;
	remark?: string;
	createdAt: string;
	updatedAt: string;
	items: OrderItem[];
}

// 订单项类型定义
export interface OrderItem {
	id: number;
	orderId: number;
	productId: number;
	price: number;
	quantity: number;
	product: Product;
	skuId?: number;
	skuSpecs?: Record<string, string>;
}
